using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Backend.JYD.Model;

namespace Backend.JYD.EFDAL.Mapping
{
    public class EmpRoleInfoMap : EntityTypeConfiguration<EmpRoleInfo>
    {
        public EmpRoleInfoMap()
        {
            // Primary Key
            this.HasKey(t => new { t.EmpId, t.RoleId });

            // Properties
            this.Property(t => t.EmpId)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.RoleId)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("EmpRoleInfo");
            this.Property(t => t.EmpId).HasColumnName("EmpId");
            this.Property(t => t.RoleId).HasColumnName("RoleId");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
            this.Property(t => t.OpId).HasColumnName("OpId");
        }
    }
}
